package model.surface;


/**
 * Class representing a simple screen point with x, y coordinates and can have
 * property to check if is taken e.g. there is an object on that point.
 * 
 * @author EvilTeam
 * 
 */
public class ScreenPoint {

	private float xPoint;
	private float yPoint;
	private boolean isTaken = false;

	protected ScreenPoint(float xScaleFactor, float yScaleFactor) {
		this.setScaledXPoint(xScaleFactor);
		this.setScaledYPoint(yScaleFactor);
	}

	public ScreenPoint(float xPoint, float yPoint, boolean isTaken) {
		this.setxPoint(xPoint);
		this.setyPoint(yPoint);
		setTaken(isTaken);
	}

	public float getxPoint() {
		return xPoint;
	}

	public void setxPoint(float xPoint) {
		if (xPoint >= 0)
			this.xPoint = xPoint;
	}

	/**
	 * Set a scaled x point depending on screen size.
	 * 
	 * @param xScaleFactor
	 *            - scale factor
	 */
	public void setScaledXPoint(float xScaleFactor) {
		if (xScaleFactor >= 0) {
			if (xScaleFactor == 0)
				this.xPoint = xScaleFactor;
			else
				this.xPoint = Scale.getScreenWidth() / xScaleFactor;
		}
	}

	public float getyPoint() {
		return yPoint;
	}

	public void setyPoint(float yPoint) {
		if (yPoint >= 0)
			this.yPoint = yPoint;
	}

	/**
	 * Set a scaled y point depending on screen size.
	 * 
	 * @param yScaleFactor
	 *            - scale factor
	 */
	public void setScaledYPoint(float yScaleFactor) {
		if (yScaleFactor >= 0) {
			if (yScaleFactor == 0)
				this.yPoint = yScaleFactor;
			else
				this.yPoint = Scale.getScreenHeight() / yScaleFactor;
		}
	}

	public boolean isTaken() {
		return isTaken;
	}

	public void setTaken(boolean isTaken) {
		this.isTaken = isTaken;
	}
}
